home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Leonardo the Inventor
/
Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso
/
LEOWINMV
/
DATABASE.DIR
/
00092_Script_PAGES
< prev
next >
Wrap
Text File
|
1996-03-28
|
7KB
|
228 lines
-- --------------------------------------------------------------
-- Handler showPage shows the next page of the text in the given
-- direction.
on showPage direction
global textSprite
set the editableText of sprite textSprite = FALSE
set nextPageCastNumber = getNextPageCast(direction)
set the castNum of sprite textSprite = nextPageCastNumber
setTopicTextAttributes(nextPageCastNumber)
updateCurrentPage(direction)
showMoreButtons
updateStage
end
-- --------------------------------------------------------------
-- Handler resetCurrentPage resets the global variable currentPage
-- to 1. This global variable is used to indicate the page number
-- of the currently displayed page of text (to know what page
-- number the previous and next pages are for pageUp and pageDown).
on resetCurrentPage
global currentPage
set currentPage = 1
end
-- --------------------------------------------------------------
-- Handler updateCurrentPage sets the global variable currentPage
-- to the next page in the given direction.
on updateCurrentPage direction
global currentPage
set currentPage = currentPage + direction
end
-- --------------------------------------------------------------
-- Handler setCurrentPage sets the global variable currentPage
-- to the page number of the current topic text.
on setCurrentPage -- called from journeyClick
global currentPage, textSprite
set currentPage = value(the last char of the name of cast the castNum of sprite textSprite)
end
-- --------------------------------------------------------------
-- Handler getNextPageCast returns the cast number of the next page
-- if the current topic has more pages and -1 otherwise.
on getNextPageCast direction
global textSprite, currentPage
waitCursor
set castNumber = getTextCastNumber(clickedTopic, currentPage + direction)
normalCursor
return castNumber
end
-- --------------------------------------------------------------
-- Handler showMoreButtons shows the up and down arrows if more
-- pages exist.
on showMoreButtons
global pageUpButton, pageDownButton, topicProperty
if (topicProperty = "text") then
if morePagesExist(-1) then -- pages up
set upStatus = 1
else
set upStatus = 0
end if
if morePagesExist(1) then -- pages down
set downStatus = 1
else
set downStatus = 0
end if
else if (topicProperty = "picture") then
if morePicturesExist(-1) then -- pages up
set upStatus = 1
else
set upStatus = 0
end if
if morePicturesExist(1) then -- pages down
set downStatus = 1
else
set downStatus = 0
end if
end if
if (upStatus and DownStatus) then
showPageUpButton("Enabled")
showPageDownButton("Enabled")
setButtonCursor (1, pageUpButton)
setButtonCursor (1, pageDownButton)
end if
if (upstatus and not(downStatus)) then
showPageUpButton("Enabled")
showPageDownButton("Disabled")
setButtonCursor (1, pageUpButton)
setButtonCursor (0, pageDownButton)
end if
if (not(upstatus) and downStatus) then
showPageDownButton("Enabled")
showPageUpButton("Disabled")
setButtonCursor (0, pageUpButton)
setButtonCursor (1, pageDownButton)
end if
if (not(upstatus) and not(downStatus)) then
removeMoreButtons
setButtonCursor (0, pageUpButton)
setButtonCursor (0, pageDownButton)
end if
end
-- --------------------------------------------------------------
-- Handler removeMoreButtons removes from the screen the up and
-- down arrows that indicate more pages.
on removeMoreButtons
global pageUpButton, pageDownButton
removeFromStage(pageUpButton)
removeFromStage(pageDownButton)
end
-- --------------------------------------------------------------
-- Handler morePagesExist returns TRUE if there are more pages
-- in the given direction (-1 = page up, 1 = page down) and FALSE
-- otherwise.
on morePagesExist direction
global numPagesInClickedTopic, currentPage
if ((direction = 1) and (currentPage < numPagesInClickedTopic)) or ((direction = -1) and (currentPage <> 1)) then
return TRUE
else
return FALSE
end if
end
-- --------------------------------------------------------------
-- Handler showPageUpButton shows the page up button.
on showPageUpButton status
global pageUpButton, pageUpH, pageUpV
changeButtonCast pageUpButton, status
set the locH of sprite pageUpButton = pageUpH
set the locV of sprite pageUpButton = pageUpV
end
-- --------------------------------------------------------------
-- Handler showPageDownButton shows the page down button.
on showPageDownButton status
global pageDownButton, pageDownH, pageDownV
changeButtonCast pageDownButton, status
set the locH of sprite pageDownButton = pageDownH
set the locV of sprite pageDownButton = pageDownV
end
-- --------------------------------------------------------------
-- Handler setNumPagesInClickedTopic sets the global variable
-- numPagesInClickedTopic to the number of pages in the article
-- of the clicked topic.
on setNumPagesInClickedTopic
global numPagesInClickedTopic, numPagesAll, clickedTopic
set the itemDelimiter = ":"
set theLine = binSearchFirstItemInLine(numPagesAll, clickedTopic, ":")
if (theLine = 0) then
alert clickedTopic && "is not in field numPages per Topic"
else
set numPagesInClickedTopic = item 2 of line theLine of numPagesAll
end if
set the itemDelimiter = ","
end
-- --------------------------------------------------------------
-- Handler morePicturesExist returns TRUE if there are more pictures
-- in the given direction (-1 = page up, 1 = page down) and FALSE
-- otherwise.
on morePicturesExist direction
global numPicturesInClickedTopic, currentPicture
if ((direction = 1) and (currentPicture < numPicturesInClickedTopic)) or ((direction = -1) and (currentPicture <> 1)) then
return TRUE
else
return FALSE
end if
end
-- --------------------------------------------------------------
-- Handler setNumPicturesInClickedTopic sets the global variable
-- numPicturesInClickedTopic to the number of pictures in
-- the clicked topic.
on setNumPicturesInClickedTopic
global numPicturesInClickedTopic, numPicturesAll, clickedTopic
set the itemDelimiter = ":"
set theLine = binSearchFirstItemInLine(numPicturesAll, clickedTopic, ":")
if (theLine = 0) then
alert clickedTopic && "is not in field numPictures per Topic"
else
set numPicturesInClickedTopic = item 2 of line theLine of numPicturesAll
end if
set the itemDelimiter = ","
end